package com.coffeeloversupportlibrary.coffeelover.uicompont;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.coffeeloversupportlibrary.R;

/**
 * @author puyv
 * @createTime 2021/11/28 20:28
 * @projectName CoffeeLoverSupportLibrary
 * @className MyDialog.java
 * @description TODO  包含特效的自定义对话框
 */
public class MyDialog extends Dialog {
    private View root;

    public MyDialog(@NonNull Context context) {
        super(context);
    }

    public void setView(){
        View originView=LayoutInflater.from(getContext()).inflate(R.layout.my_dialog,null);
        root=originView;
        setContentView(originView);
    }

    // TODO: 2021/11/28   开启风扇 
    public void run(){
        ImageView fan=root.findViewById(R.id.fan);
        RotateAnimation rotateAnimation = AnimationUtils.initRotateAnimation(true, 1000, true, Animation.INFINITE);
        fan.setAnimation(rotateAnimation);
    }
    @Override
    public void setContentView(@NonNull View view) {
        super.setContentView(view);
    }

    protected MyDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

}
